<!DOCTYPE html>
<html>

<head>
	<meta charset="utf-8">
	<title>绿地养护</title>
	<meta name="viewport"
		content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
	<meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
	<link rel="stylesheet" type="text/css" href="../../css/api.css" />
	<link rel="stylesheet" type="text/css" href="../../css/globle.css" />
	<script src="http://www.jq22.com/jquery/jquery-1.10.2.js"></script>
	<link rel="stylesheet" type="text/css" href="../../css/common.css" />
	<style>
		body {
			padding-top: 25px;
		}

		span {
			margin: 10px;
		}

		.Tabl {
			height: 50px;
			width: 88%;
			font-size: 14px;

			text-align: left;
			margin-left: 6%;
		}

		.Td1 {
			color: #B8B8B8;
			font-weight: bold;
			width: 70px;
			font-size: 15px;
		}

		.Td2 {

			text-align: left;
			width: 80px;
			color: rgb(85, 85, 85);
			font-size: 15px;
		}

		.Hr {
			height: 1px;
			width: 96%;
			background-color: #D8D8D8;
			margin-left: 2%;
		}

		.Td3 {
			background-color: #1ABC9C;
			text-align: center;
			width: 50%;
		}

		.Butt {
			border: 1px solid #B8B8B8;
			border-radius: 20px;
			color: #FFFFFF;
			height: 17px;
			width: 17px;
			outline: none;
		}

		.TabImg {
			height: 150px;
			width: 96%;
			margin-left: 2%;
			border: 10px solid #D8D8D8;
		}

		.TdImg1 {
			height: 110px;
			width: 90px;
		}

		.TdImg2 {
			height: 110px;
			width: 90px;
		}

		.ButAdd {
			height: 110px;
			width: 100px;
			font-size: 100px;
			color: #FFFFFF;
			background-color: #B8B8B8;
		}

		.TabL {
			height: 75px;
			width: 88%;
			font-size: 16px;
			font-weight: bold;
			text-align: left;
			margin-left: 6%;
		}

		.ButL {
			height: 40px;
			width: 100%;
			background-color: #D0D0D0;
			position: fixed;
			bottom: 0;
		}

		.Td3 {
			text-align: center;
			width: 50%;
		}

		select {
			appearance: none;
			-moz-appearance: none;
			-webkit-appearance: none;
			border: none;
			background: none;
		}
	</style>
</head>

<body>

	<table class="Tabl">
		<tr>
			<td class="Td1">日期</td>
			<td class="Td2"><input type="date" id="att_time" style="padding: 0px;" /> </td>
		</tr>
	</table>
	<hr class="Hr" />
	<button style="background-color: #F2F2F2;height: 40px;width: 100%;font-size: 18px;">上午健康</button>
	<hr class="Hr" />
	<div id="detailed"></div>
	<div style="padding: 10px;">
		<ul class="upload-ul clearfix">
			<li class="upload-pick">
				<div class="webuploader-container clearfix" id="goodsUpload"></div>
			</li>
			<li>
				<div id="imgBoxAm" name="a_am_picture"></div>
			</li>
		</ul>
	</div>
	<hr class="Hr" />
	<button style="background-color: #F2F2F2;height: 40px;width: 100%;font-size: 18px;">下午健康</button>
	<hr class="Hr" />
	<div id="detailedpm"></div>


	<div style="padding: 10px;margin-bottom: 50px;">
		<ul class="upload-ul clearfix">
			<li class="upload-pick">
				<div class="webuploader-container clearfix" id="goodsUpload1"></div>
			</li>
			<li>
				<div id="imgBoxAm" name="a_pm_picture"></div>
			</li>
		</ul>
	</div>

	<table class="ButL" id="ButL">

	</table>
</body>
<script src="../../script/webuploader.min.js"></script>
<script src="../../script/jquery.js"></script>
<script src="../../script/diyUpload.js"></script>
<script src="../../script/vue.js"></script>
<script src="../../script/common.js"></script>
<script type="text/javascript" src="../../script/api.js"></script>
<script type="text/javascript">
	var $tgaUpload = $("#goodsUpload").diyUpload({
			url: BaseServiceUrl + "mobile/healthy/uploudpt.json",
			success: function (data) {
				//alert(JSON.stringify(data))
			},
			error: function (err) {
				alert(JSON.stringify(err));
			},
			buttonText: "",
			accept: {
				title: "Images",
				extensions: "gif,jpg,jpeg,bmp,png",
				mimeTypes: 'image/*'
			},
			fileNumLimit:1,
			thumb: {
				width: 600,
				height: 600,
				quality: 100,
				allowMagnify: false,
				crop: false,
				type: "image/jpeg",
			},
		});
		$tgaUpload.options.formData.dids = null;
		$tgaUpload.options.formData.ampm = "am";
		var $tgaUpload1 = $("#goodsUpload1").diyUpload({
			url: BaseServiceUrl + "mobile/healthy/uploudpt.json",
			success: function (data) {
				//alert(JSON.stringify(data))
			},
			error: function (err) {
				alert(JSON.stringify(err));
			},
			buttonText: "",
			accept: {
				title: "Images",
				extensions: "gif,jpg,jpeg,bmp,png",
				mimeTypes: 'image/*'
			},
			fileNumLimit:1,
			thumb: {
				width: 600,
				height: 600,
				quality: 100,
				allowMagnify: false,
				crop: false,
				type: "image/jpeg",
			},
		});
		$tgaUpload1.options.formData.dids = null;
		$tgaUpload1.options.formData.ampm = "pm";
	apiready = function () {
	
		//赋值当日考勤日期
		var thisday = new Date();
		thisday.setTime(thisday.getTime());
		var year = thisday.getFullYear();
		var month = thisday.getMonth() + 1;
		var day = thisday.getDate()
		if (month < 10) {
			month = "0" + month;
		}
		if (day < 10) {
			day = "0" + day;
		}
		var s = year + "-" + month + "-" + day;
		$("#att_time").val(s);
		//片区id
		// var areaid = $api.getStorage('selectpor').id
		var areaid = null;
		var reg = $api.getStorage("userSession");
		var sids = reg.data.sysRole.sysRoleCode;
		var role = sids.role_number;
		if (role != "construction") {
			areaid = $api.getStorage("selectpor").id;
		} else {
			areaid = reg.data.areaid;
		}
		//项目id
		var proid = $api.getStorage('userSession').data.proId;
		//企业id
		var enterpriseid = $api.getStorage('userSession').data.enterprise.id;
		var teamid = $api.getStorage('userSession').data.team_id
		//查找该施工账号下所有成员
		$.ajax({
			url: BaseServiceUrl + "mobile/healthy/findMember.json",
			type: "POST",
			data: {
				'tid': teamid,
			},
			dataType: "json",
			success: function (ret) {
				var num = 0;
				var h = "";
				var data = ret.data
				for (var i = 0; i < data.length; i++) {
					num++;
					h += "<table class='Tabl' style='margin-top: 5px'><tr>" +
						"<td class='Td1'>姓名</td>" +
						"<td class='Td2'><input id='name" + num + "'  value='" + data[i].m_name +
						"' disabled type='text'> </td>" +
						"</tr>" +
						"<tr>" +
						"<td class='Td1'>体温状态</td>" +
						"<td class='Td2'> <select id='temyes" + num +
						"' style='display: block;width: 100%;'><option value='0'>正常</option><option value='1'>异常</option></select></td>" +
						"</tr>" +
						"<tr>" +
						"<td class='Td1'>血压状态</td>" +
						"<td class='Td2'><select id='bloodyes" + num +
						"' style='display: block;width: 100%;'><option value='0'>正常</option><option value='1'>异常</option></select> </td>" +
						"</tr>" +
						"<tr>" +
						"</tr>" +
						"<tr style='height: 20px'>" +
						"<td class='Td1'></td>" +
						"<td class='Td2'></td>" +
						"</tr></table><hr class='Hr'/>"
				}
				var s = "";
				for (var i = 0; i < data.length; i++) {
					num++;
					s += "<table class='Tabl' style='margin-top: 5px'><tr>" +
						"<td class='Td1'>姓名</td>" +
						"<td class='Td2'><input id='name" + num + "'  value='" + data[i].m_name +
						"' disabled type='text'> </td>" +
						"</tr>" +
						"<tr>" +
						"<td class='Td1'>体温状态</td>" +
						"<td class='Td2'> <select id='temyes" + num +
						"' style='display: block;width: 100%;'><option value='0'>正常</option><option value='1'>异常</option></select></td>" +
						"</tr>" +
						"<tr>" +
						"<td class='Td1'>血压状态</td>" +
						"<td class='Td2'><select id='bloodyes" + num +
						"' style='display: block;width: 100%;'><option value='0'>正常</option><option value='1'>异常</option></select> </td>" +
						"</tr>" +
						"<tr>" +
						"</tr>" +
						"<tr style='height: 20px'>" +
						"<td class='Td1'></td>" +
						"<td class='Td2'></td>" +
						"</tr></table><hr class='Hr'/>"
				}
				$("#ButL").append(
					"<tr>" +
					"<td class='Td3'>" +
					"<div style='color:#FFFFFF' onclick='sublmt(" + num + ")'>完成</div></td>" +
					"</tr>"
				);

				$("#detailed").append(h);
				$("#detailedpm").append(s);
			},
			error: function (jqXHR, textStatus, errorThrown) {}
		});

	};


	//上传信息
	function sublmt(num) {

		var names = new Array()
		for (var k = 1; k <= num; k++) {
			if ($("#name" + k + "").val() != undefined) {
				names.push($("#name" + k + "").val());
			}
		}

		var temyess = new Array()
		for (var kss = 1; kss <= num; kss++) {
			if ($("#temyes" + kss + "").val() != undefined) {
				temyess.push($("#temyes" + kss + "").val());
			}
		}

		var bloodyess = new Array()
		for (var kssss = 1; kssss <= num; kssss++) {
			if ($("#bloodyes" + kssss + "").val() != undefined) {
				bloodyess.push($("#bloodyes" + kssss + "").val());
			}
		}

		//片区id
		var areaid = null;
		var reg = $api.getStorage("userSession");
		var sids = reg.data.sysRole.sysRoleCode;
		var role = sids.role_number;
		if (role != "construction") {
			areaid = $api.getStorage("selectpor").id;
		} else {
			areaid = reg.data.areaid;
		}
		// alert(areaid)
		//项目id
		var proid = $api.getStorage('userSession').data.proId;
		//企业id
		var enterpriseid = $api.getStorage('userSession').data.enterprise.id;
		//队伍id
		var teamid = $api.getStorage('userSession').data.team_id;
		var times = $("#att_time").val();
		$.ajax({
			url: BaseServiceUrl + "mobile/healthy/savejk.json",
			type: "POST",
			data: {
				'proid': proid,
				'areaid': areaid,
				'enterpriseid': enterpriseid,
				'teamid': teamid,
				'names': names.toString(),
				'temyess': temyess.toString(),
				'bloodyess': bloodyess.toString(),
				'times': times
			},
			dataType: 'json',
			async: 'true',
			success: function (ret) {

				if (ret.code == 0) {

					$tgaUpload.options.formData.dids = ret.data
					$tgaUpload.upload();
					$tgaUpload1.options.formData.dids = ret.data
					$tgaUpload1.upload();
					api.showProgress({
						//打开开关
						title: "提交中...",
						text: "",
					});
					setTimeout(function () {
						api.closeWin();
					}, 5000);
				}
			},
			error: function (XMLHttpRequest, textStatus, errorThrown) {
				// alert(XMLHttpRequest.status);
				// alert(XMLHttpRequest.readyState);
				//   alert(textStatus);
			}
		});
	}
</script>

</html>